home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / crazy_ch.swf / scripts / frame_3 / DoAction_3.as < prev    next >
Encoding:
Text File  |  2011-06-09  |  6.2 KB  |  193 lines

  1. function helibeenhit()
  2. {
  3.    var _loc1_ = 0;
  4.    while(_loc1_ < wall_ar.length)
  5.    {
  6.       if(heli._x + 54 > wall_ar[_loc1_]._x - wall_ar[_loc1_]._width / 2 && heli._x - 54 < wall_ar[_loc1_]._x + wall_ar[_loc1_]._width / 2 && heli._y + 18 > wall_ar[_loc1_]._y - wall_ar[_loc1_]._height / 2 && heli._y - 18 < wall_ar[_loc1_]._y + wall_ar[_loc1_]._height / 2)
  7.       {
  8.          cols = "down";
  9.          lose();
  10.       }
  11.       _loc1_ = _loc1_ + 1;
  12.    }
  13.    _loc1_ = 0;
  14.    while(_loc1_ < wall_ar_up.length)
  15.    {
  16.       if(heli._x + 54 > wall_ar_up[_loc1_]._x - wall_ar_up[_loc1_]._width / 2 && heli._x - 54 < wall_ar_up[_loc1_]._x + wall_ar_up[_loc1_]._width / 2 && heli._y + 18 > wall_ar_up[_loc1_]._y - wall_ar_up[_loc1_]._height / 2 && heli._y - 18 < wall_ar_up[_loc1_]._y + wall_ar_up[_loc1_]._height / 2)
  17.       {
  18.          cols = "up";
  19.          lose();
  20.       }
  21.       _loc1_ = _loc1_ + 1;
  22.    }
  23.    _loc1_ = 0;
  24.    while(_loc1_ < obs_ar.length)
  25.    {
  26.       if(heli._x + 54 > obs_ar[_loc1_]._x - obs_ar[_loc1_]._width / 2 && heli._x - 54 < obs_ar[_loc1_]._x + obs_ar[_loc1_]._width / 2 && heli._y + 18 > obs_ar[_loc1_]._y - obs_ar[_loc1_]._height / 2 && heli._y - 18 < obs_ar[_loc1_]._y + obs_ar[_loc1_]._height / 2 && obs_ar[_loc1_]._currentframe == 1)
  27.       {
  28.          cols = "obs";
  29.          lose();
  30.       }
  31.       var _loc2_ = 0;
  32.       while(_loc2_ < pac_shoot.length)
  33.       {
  34.          if(pac_shoot[_loc2_]._x + 10 > obs_ar[_loc1_]._x - obs_ar[_loc1_]._width / 2 && pac_shoot[_loc2_]._x - 10 < obs_ar[_loc1_]._x + obs_ar[_loc1_]._width / 2 && pac_shoot[_loc2_]._y + 6 > obs_ar[_loc1_]._y - obs_ar[_loc1_]._height / 2 && pac_shoot[_loc2_]._y - 6 < obs_ar[_loc1_]._y + obs_ar[_loc1_]._height / 2 && obs_ar[_loc1_]._currentframe == 1)
  35.          {
  36.             expl_fun(pac_shoot[_loc2_]);
  37.             obs_ar[_loc1_].gotoAndPlay(2);
  38.             scoreplus("point_p_50",pac_shoot[_loc2_]);
  39.             score_num += 50;
  40.             removeMovieClip(pac_shoot[_loc2_]);
  41.          }
  42.          _loc2_ = _loc2_ + 1;
  43.       }
  44.       _loc1_ = _loc1_ + 1;
  45.    }
  46. }
  47. function lose()
  48. {
  49.    savercore();
  50.    trace("you lose");
  51.    clearInterval(inter_wall);
  52.    clearInterval(inter_obs);
  53.    clearInterval(inter_score);
  54.    clearInterval(heli_inter);
  55.    clearInterval(inter_hostage);
  56.    heli_speed = 0;
  57.    live = 1;
  58.    player = 0;
  59.    if(cols == "obs")
  60.    {
  61.       heli_bb._x = heli._x;
  62.       heli_bb._y = heli._y;
  63.       expl_fun(heli);
  64.       heli_bb.gotoAndPlay(2);
  65.    }
  66.    if(cols == "up" || cols == "down")
  67.    {
  68.       mas_up_boom._x = heli._x;
  69.       mas_up_boom._y = heli._y;
  70.       expl_fun(heli);
  71.       copup_inter = setInterval(col_up,15);
  72.       sound_a1 = 2;
  73.    }
  74.    heli._x = 1000;
  75.    heli._y = 1000;
  76.    res_but._x = 520;
  77.    res_but._y = 100;
  78.    men_but._x = 520;
  79.    men_but._y = 240;
  80.    butxx._x = 520;
  81.    butxx._y = 170;
  82.    you._x = 160;
  83.    you._y = 100;
  84.    name1._x = 220;
  85.    name1._y = 88;
  86.    joy._x = 500;
  87.    joy._y = 444;
  88.    var _loc1_ = 0;
  89.    while(_loc1_ < obs_ar.length)
  90.    {
  91.       removeMovieClip(obs_ar[_loc1_]);
  92.       _loc1_ = _loc1_ + 1;
  93.    }
  94. }
  95. function checkhitHos()
  96. {
  97.    var _loc1_ = 0;
  98.    while(_loc1_ < hos_ar.length)
  99.    {
  100.       if(hos_ar[_loc1_]._x + 5 > heli._x - 50 && hos_ar[_loc1_]._x - 5 < heli._x + 50 && hos_ar[_loc1_]._y + 8 > heli._y - 18 && hos_ar[_loc1_]._y - 8 < heli._y + 18 && hos_ar[_loc1_]._currentframe <= 20)
  101.       {
  102.          if(hos_ar[_loc1_].the_scr == 0)
  103.          {
  104.             scoreplus("point_p_20",hos_ar[_loc1_]);
  105.             score_num += 20;
  106.             hos_ar[_loc1_].gotoAndPlay(31);
  107.          }
  108.          else if(hos_ar[_loc1_].the_scr == 1)
  109.          {
  110.             scoreplus("point_p_30",hos_ar[_loc1_]);
  111.             score_num += 30;
  112.             hos_ar[_loc1_].gotoAndPlay(31);
  113.          }
  114.          else if(hos_ar[_loc1_].the_scr == 2)
  115.          {
  116.             scoreplus("point_p_50",hos_ar[_loc1_]);
  117.             score_num += 50;
  118.             hos_ar[_loc1_].gotoAndPlay(31);
  119.          }
  120.          else if(hos_ar[_loc1_].the_scr == 3)
  121.          {
  122.             scoreplus("point_p_100",hos_ar[_loc1_]);
  123.             score_num += 100;
  124.             hos_ar[_loc1_].gotoAndPlay(31);
  125.          }
  126.          else if(hos_ar[_loc1_].the_scr == 4)
  127.          {
  128.             scoreplus("point_p_ammo",hos_ar[_loc1_]);
  129.             ammo += 2;
  130.             hos_ar[_loc1_].gotoAndPlay(31);
  131.          }
  132.          removeMovieClip(hos_ar[_loc1_]);
  133.       }
  134.       if(hos_ar[_loc1_]._x + 5 > heli._x - 50 && hos_ar[_loc1_]._x - 5 < heli._x + 50 && hos_ar[_loc1_]._y - 35 > heli._y - 18 && hos_ar[_loc1_]._y - 56 < heli._y + 18 && hos_ar[_loc1_]._currentframe <= 20)
  135.       {
  136.          hos_ar[_loc1_].gotoAndPlay(21);
  137.          scoreplus("point_p_10",hos_ar[_loc1_]);
  138.          score_num -= 200;
  139.       }
  140.       _loc1_ = _loc1_ + 1;
  141.    }
  142. }
  143. function col_up()
  144. {
  145.    mas_up_boom._x += speed_fall;
  146.    mas_up_boom._y += speed_fall_y;
  147.    mas_up_boom._rotation += rotation_heli;
  148.    var _loc1_ = 0;
  149.    while(_loc1_ < wall_ar.length)
  150.    {
  151.       if(mas_up_boom._x + 54 > wall_ar[_loc1_]._x - wall_ar[_loc1_]._width / 2 && mas_up_boom._x - 54 < wall_ar[_loc1_]._x + wall_ar[_loc1_]._width / 2 && mas_up_boom._y + 18 > wall_ar[_loc1_]._y - wall_ar[_loc1_]._height / 2 && mas_up_boom._y - 18 < wall_ar[_loc1_]._y + wall_ar[_loc1_]._height / 2)
  152.       {
  153.          if(mas_up_boom._rotation > 0)
  154.          {
  155.             rotation_heli = -0.8;
  156.          }
  157.          mas_up_boom._y -= 5;
  158.          if(speed_fall > 0)
  159.          {
  160.             speed_fall -= 0.1;
  161.          }
  162.          if(mas_up_boom._rotation < 0 && mas_up_boom._currentframe == 1)
  163.          {
  164.             rotation_heli = 0;
  165.             mas_up_boom.gotoAndPlay(2);
  166.             expl_fun(mas_up_boom);
  167.          }
  168.       }
  169.       _loc1_ = _loc1_ + 1;
  170.    }
  171. }
  172. function savercore()
  173. {
  174.    var _loc1_ = SharedObject.getLocal("hind");
  175.    trace("iso=" + _loc1_.data.userId);
  176.    if(score_num > _loc1_.data.userId || _loc1_.data.userId == undefined)
  177.    {
  178.       _loc1_.data.userId = score_num;
  179.       trace(_loc1_.data.userId);
  180.       _loc1_.onStatus = function(ff)
  181.       {
  182.          trace(ff.code);
  183.       };
  184.       var _loc2_ = _loc1_.flush(1000);
  185.    }
  186. }
  187. stop();
  188. var cols = "";
  189. var copup_inter;
  190. var speed_fall = 1;
  191. var speed_fall_y = 5;
  192. var rotation_heli = 0.5;
  193.